package config

import "fmt"

type Config struct {
	Service  Dict
	Redis    Dict
	Database Dict
	Log      Dict
	I18n     Dict
}

type Dict map[string]any

func (d Dict) GetString(key string) string {
	defer func() {
		if err := recover(); err != nil {
			fmt.Printf("[%s], error: %v", key, err)
		}
	}()
	item := d[key]
	return item.(string)
}

func (d Dict) GetInt(key string) int {
	defer func() {
		if err := recover(); err != nil {
			fmt.Printf("[%s], error: %v", key, err)
		}
	}()
	item := d[key]
	return item.(int)
}
